<?php
class User extends CActiveRecord {
	public static function model($className=__CLASS__)	{
		return parent::model($className);
	}
	public function tableName() {
		return 'user';
	}
	public function rules()	{
		return array(
			array('username, password', 'required'),
			array('username', 'length', 'max'=>15),
			array('password', 'length', 'max'=>150),
			array('id, username, password', 'safe', 'on'=>'search'),
		);
	}
	public function relations() {
		return array();
	}
	public function attributeLabels() {
		return array(
			'id' => 'ID',
			'username' => 'Username',
			'password' => 'Password',
		);
	}
	public function search() {
		$criteria=new CDbCriteria;
		$criteria->compare('id',$this->id);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('password',$this->password,true);
		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}